package tests.sorting;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import sorting.SelectionSort;

public class SelectionSortTestCase {

	private String[] sampleStringDataToBeSorted;

	@Before
	public void setUp() throws Exception {
		this.sampleStringDataToBeSorted = new String[5];
		this.sampleStringDataToBeSorted[0] = "z";
		this.sampleStringDataToBeSorted[1] = "x";
		this.sampleStringDataToBeSorted[2] = "y";
		this.sampleStringDataToBeSorted[3] = "c";
		this.sampleStringDataToBeSorted[4] = "a";
	}

	@After
	public void tearDown() throws Exception {
		this.sampleStringDataToBeSorted = null;
	}

	@Test
	public void testStringArray() {

		String[] expectedStringArray = {"a","c","x","y","z"};

		SelectionSort.sort(this.sampleStringDataToBeSorted);
		int index = 0;
		for (String s : this.sampleStringDataToBeSorted) {
			assertEquals(expectedStringArray[index], s);
			index++;
		}
	}

}
